package com.ctshk.rpc.order.bus.service.impl;

import java.util.List;

import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import com.ctshk.common.dto.Result;
import com.ctshk.common.service.support.BaseService;
import com.ctshk.rpc.order.bus.dto.BusInsuranceReceiptInfoDTO;
import com.ctshk.rpc.order.bus.dto.BusOrderTouristDTO;
import com.ctshk.rpc.order.bus.mapper.BusInsuranceReceiptMapper;
import com.ctshk.rpc.order.bus.mapper.BusOrderTouristMapper;
import com.ctshk.rpc.order.bus.service.IBusInsuranceReceiptService;

/**
 * 保单收据service
 * 
 * @author Qiaoxin.Hong
 *
 */
@DubboService
public class BusInsuranceReceiptServiceImpl implements IBusInsuranceReceiptService, BaseService {
	
	@Autowired
	BusInsuranceReceiptMapper busInsuranceReceiptMapper;
	
	@Autowired
	BusOrderTouristMapper busOrderTouristMapper;

	/**
	 * 根据订单ID查询保单收据信息
	 * @param orderId
	 * @return
	 */
	@Override
	public Result<BusInsuranceReceiptInfoDTO> findReceiptInfo(Long orderId) {
		BusInsuranceReceiptInfoDTO dto = busInsuranceReceiptMapper.assertExistSelectOneByKey(BusInsuranceReceiptInfoDTO.class, "order_id", orderId);
		
		//旅客列表
		List<BusOrderTouristDTO> touristList = busOrderTouristMapper.selectListByKey(BusOrderTouristDTO.class, "order_id", orderId);
		dto.setTouristList(touristList);
		
		return newResult(dto);
	}

}
